package luogu;

import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        int[] days = new int[7];
        Scanner sc = new Scanner(System.in);
        int max = 0;
        int day = 0;
        for (int i = 1; i < days.length+1; i++) {
            int school = sc.nextInt();
            int home = sc.nextInt();
            int time = school + home;
            if (time > max && time > 8) {
                max=time;
                day = i ;
            }
        }
        System.out.println(day);
    }
}
